import Vue from 'vue'
import ElementUI from "element-ui";
import {Loading} from "element-ui";
//引入element-ui样式
import "element-ui/lib/theme-chalk/index.css";
Vue.use(ElementUI);
//引入router，先在router/index.js中配置router，并export defaults暴露出去
import router from './router';
import axios from "axios";
import App from './App.vue';
import enumsFilter from "../public/base/js/web/enumsFilter";
//阻止显示生产模式的消息
Vue.config.productionTip = false
//解决前后端分离，每次请求sessionId不同（验证码+登录问题，需要相同验证码）
axios.defaults.withCredentials=true;
//vue全局组件监听事件总线，所有组件发送请求都必须经过这个总线$event
Vue.prototype.$event=new Vue();
/**
 * axios请求日志拦截
 */
axios.interceptors.request.use(function (request) {
  //console.log("发出请求：", request);
  return request;
},error => {});
axios.interceptors.response.use(function (response) {
  //console.log("获取响应：",response);
  return response;
},error => {});

//增加enumsFilter全局过滤器(js)：用于下拉框的显示效果
Object.keys(enumsFilter).forEach(key => {
  Vue.filter(key, enumsFilter[key]);
});

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')

//使用全局环境变量：process.env.*
//console.log("全局dev/prod环境配置: ", process.env.NODE_ENV);
//console.log("全局dev/prod环境前缀: ", process.env.VUE_APP_SERVER);